package com.cloud.common.domain;

import java.io.Serializable;

/**
 * 服务端同意返回类
 *
 * @author wangjian
 * @version 1.0.0
 * @create 2020年10月26日 15:40
 * @since JDK 1.8
 * Life is so short,do something to make yourself happy,such as coding
 */
public class DefaultResult<T> implements Serializable {

    private static final long serialVersionUID = 2256293582975321366L;

    boolean success;

    String msg;

    Integer code;

    T resultObj;

    public DefaultResult() {
    }

    public DefaultResult(boolean success, String msg, T resultObj) {
        this.success = success;
        this.msg = msg;
        this.resultObj = resultObj;
    }

    public DefaultResult(boolean success,int code, String msg, T resultObj) {
        this.success = success;
        this.code = code;
        this.msg = msg;
        this.resultObj = resultObj;
    }

    public static DefaultResult success(Object data) {
        return new DefaultResult(true, null, data);
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getResultObj() {
        return resultObj;
    }

    public int getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setResultObj(T resultObj) {
        this.resultObj = resultObj;
    }

}
